#include <iostream>
#include <string.h>
#include <complex>
#include <math.h>
#include <armadillo>
//#define MKL_Complex16 std::complex<double>

using namespace arma;
using namespace std;

#define pi 3.141592653589793
// hbar in eV fs
#define hbar 0.652 

using namespace std;
typedef struct tb{
  double Esa, Epa, Esc, Epc, Essa, Essc;
  double Vss, Vxx, Vyy,Vxy,Vscpa, Vsapc, Vssapc, Vpassc;
  double Vpasc,Vpcsa,Vpcssa,Vsscpa,Vssss;
  double soa,soc;
  string name;
  string mat;
};

struct tb parameters(string name,string mat);

cx_mat berry(cx_mat *eigvec,imat mask,int nplaq,double plaqarea,cx_mat L[]);

void Ham(struct tb p,const cx_rowvec& g,
	 cx_mat& H, cx_mat& HL, cx_mat& HR, cx_mat& VLR);

void so(cx_mat & H,
	const double lambda,const int n,
	const double xp, 
	const double yp, 
	const double zp);

inline bool strcmpi(string a, string b){
  return a==b;
};


void hamiltonian(struct tb p,rowvec kvec,cx_mat & H,cx_mat & Hc,cx_mat & Ha,
		 cx_mat & Vup,cx_mat & Vdn);

void superlatticeT(double E,string name, string mat1, int nmat1, string mat2, int nmat2,
		   rowvec kvec,cx_mat & T1,cx_mat & T2,cx_mat & T12,cx_mat & T21);

void superlatticeH(double E,
		   string name, 
		   string mat1, int nmat1,
		   string mat2, int nmat2,
		   rowvec kvec,cx_mat & H,
		   const bool velocitymat, const int cartesiancoord);

void velocitymatrix(struct tb p,rowvec kvec,cx_mat & H,cx_mat & Hc,cx_mat & Ha,
		    cx_mat & Vup,cx_mat & Vdn,int cartesiancoord);


void opticalinjection_1storder(double pulsewidth,
		      double centerfreq,
		      cx_vec pol,
		      vec E,
		      cx_mat VelocityMatrix[],
		      cx_mat U);

cx_mat berry_sumrule(cx_mat Vx, cx_mat Vy, imat mask, vec E);
